let form = layui.form;
let id = new URLSearchParams(location.search).get('id');

// 获取用户信息并渲染到页面
$.ajax({
  url: '/admin/users/' + id,
  success: function (res) {
    form.val('filter', res.data);
  }
});

$('button:contains("立即提交")').on('click', function (ev) {
  ev.preventDefault();
  $.ajax({
    url: '/admin/users',
    type: 'PUT',
    data: $('#editor').serialize(),
    success: function (res) {
      layer.msg(res.message);
    }
  })
})